#ifndef REMOTE_LOG_H
#define REMOTE_LOG_H

#include <http_connection.h>

#include <string>

class RemoteLog{
	public:
		RemoteLog(const std::string host="naaaaak.com", const std::string& path="/~aaronds109/log.php"):path(path){
		}
		RemoteLog(const RemoteLog& rl):path(rl.path){
		}
		void send(const std::string& s){
			Glib::Thread::create(sigc::bind(sigc::mem_fun(*this, &RemoteLog::send_async), s), false);
		}
		
	private:
		void send_async(const std::string& s){
			try{
				HttpConnection connection("naaaaak.com");
				std::map<std::string, std::string> get_variables;
				get_variables["message"]=s;
				HttpRequest http_request(path, get_variables);
				connection<<http_request;
			}
			catch(UnableToConnect& x){
				g_warning("RemoteLog::send_async():%s", x.what());
			}
			throw Glib::Thread::Exit();
		}
		std::string path;
};
#endif
